//
// Created by HP on 2024/1/13.
//

#ifndef AURORA_ST_AURORACOMM_H
#define AURORA_ST_AURORACOMM_H

#include "common_inc.h"

//通信总模块
class AuroraCOMM{
public:
    AuroraCOMM();


    //状态机
    typedef enum CPMM_MSTATE{
        IDLE = 0, // 空闲态
        UPDATE_FILE,
        UPDATE  , // 更新固件状态
        M_Calibration,  //电机校准
    }COMM_STATE;





    void IDLE_Deal(uint8_t *data,uint16_t len);
    void UPDATE_FILE_Deal(uint8_t *data,uint16_t len);


    void recvMsg(uint8_t *data,uint16_t len);



    void dealmsgEvent_from_FOC(struct Aurora_FOC2COMM_MSG *foc2comm_msg_p);


private:
    void sendMsg(uint8_t func1,uint8_t func2,uint8_t func3,union float_uint32_int_char *data1,union float_uint32_int_char *data2,union float_uint32_int_char *data3,union float_uint32_int_char *data4);


    void send_FOC_Param(uint8_t inst,FOC_PARAMETER_STORAGE_VALUE param_value);
private:
    uint8_t cmd_idt; //数据类型指示
    COMM_STATE state;
};
#endif //AURORA_ST_AURORACOMM_H
